<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
            <el-form-item label="汇总类别">
                <el-select v-model="queryParams.hzlb" placeholder="请选择" >
                    <el-option v-for="(item, index) in [{ label: '办案单位',value:'badw' }, { label: '案件性质',value:'ajxz', },{label:'开户银行',value: 'bsyhbh'}]" :key="index"
                        :label="item.label" :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="开始日期" prop="ksrq">
            <el-date-picker clearable
                v-model="queryParams.ksrq"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择开始日期">
            </el-date-picker>
            </el-form-item>
            <el-form-item label="结束日期" prop="jsrq">
            <el-date-picker clearable
                v-model="queryParams.jsrq"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择结束日期">
            </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <!-- <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <div style="margin-top: 5px;">
                    <el-radio v-model="queryParams.msshzt" :label="2">已通过</el-radio>
                    <el-radio v-model="queryParams.msshzt" :label="3">未通过</el-radio>
                </div>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row> -->

        <el-table v-loading="loading" height="650" :data="bzjtableList" :row-class-name="tableRowClassName"
            @current-change="tableCurrentChange">

            <el-table-column label="名称" align="center" prop="name" />
            <el-table-column label="收取金额" align="center" prop="sqje" />
            <el-table-column label="没收金额" align="center" prop="msje" />
            <el-table-column label="退还金额" align="center" prop="thje" />
            <el-table-column label="库存金额" align="center" prop="kcje" />
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />
        <el-dialog :visible.sync="pdfs" width="45%">
            <div style="display: flex;align-items: center;justify-content: center;">
                <img :src="this.pdfUrl" alt width="80%" />
            </div>
        </el-dialog>

    </div>
</template>
  
<script>
import { getHzReoprtList } from "@/api/system/bzjtable";
import selectMultiple from '@/views/collect/addSecurity/selectMultiple'
import pdf from "vue-pdf"
export default {
    name: "Bzjtable",
    data() {
        return {
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            fileList: [],
            directoryList: [],
            fileTableList: [],
            pdfs: false,
            isShow: false,
            dialogFormVisible: false,
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 【请填写功能名称】表格数据
            bzjtableList: [],
            // 弹出层标题
            tit: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                ksrq: '',
                jsrq:''
            },
            pdfUrl: '',

            currentIndex: '',
            sytsVisabled: false,
        };
    },
    components: {
        selectMultiple,
        pdf
    },
    created() {
        this.loading = false;
        // this.getList();
    },
    methods: {
        /** 查询【请填写功能名称】列表 */
        getList() {
            this.loading = true;
            getHzReoprtList(this.queryParams).then(response => {
                response.rows.forEach((item, index) => {
                    item.pIndex = index + 1
                })
                this.bzjtableList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },

        tableRowClassName({ row, column, rowIndex, columnIndex }) {
            //逻辑判断决定是否修改样式，如果分组一致则使用同一个样式
            return row.pIndex == this.currentIndex ? 'hover-bg' : ''
        },
        tableCurrentChange(row) {
            this.form = row
            this.queryParams.xh = row.xh
            this.wjdz = row.wjdz
            this.currentIndex = row?.pIndex
            this.$forceUpdate()
        },
        /** 搜索按钮操作 */
        handleQuery() {
            let ogj = {}
            ogj.xh = this.queryParams.xh
            this.queryParams.pageNum = 1
            if(this.queryParams.hzlb==null||this.queryParams.hzlb==''){
                this.$modal.msgError("请选择汇总类别");
                return
            }

            this.getList();
        },

        /** 重置按钮操作 */
        resetQuery() {
            this.queryParams.hsr = ''
            this.resetForm("queryForm");
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.xh)
            this.single = selection.length !== 1
            this.multiple = !selection.length
        },
    }
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.creation {
    .el-form-item {
        margin-bottom: 15px;
    }

    ::v-deep.el-input__inner {
        width: 250px;
    }

    .xx {
        ::v-deep.el-input__inner {
            width: 630px;
        }
    }
}

::v-deep .el-table__body-wrapper::-webkit-srollbar-track {
    background-color: rgba(255, 255, 255, 0);
}

//可设置胶囊宽高
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
    height: 12px;
    width: 10px;
    opacity: 0.5;
}

// 设置胶囊色
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
    border-radius: 15px;
    background-color: #cdd9e6;
}

::v-deep .el-table__body .el-table__row.hover-bg td {
    background-color: #cde6f7 !important;
}
</style>